package com.fone.player.storage;

import java.util.Comparator;

import com.fone.player.entity.OfflineCache;

/**
 * 
 * 根据创建时间排序
 * 
 * @author wangyang
 * @since 2014年6月5日
 */
public class OfflineCacheFolderComparator implements Comparator<OfflineCache> {

	@Override
	public int compare(OfflineCache offlineCache1, OfflineCache offlineCache2) {
		int result = 0;
		if (offlineCache1 == null || offlineCache2 == null) {
			return result;
		}

		if (offlineCache1.getCacheCreateTime() > offlineCache2
				.getCacheCreateTime()) {
			result = 1;
		} else if (offlineCache1.getCacheCreateTime() < offlineCache2
				.getCacheCreateTime()) {
			result = -1;
		}
		return result;
	}
}
